package front_user

import (
	"errors"

	"github.com/gin-gonic/gin"
)

func GetClaims(c *gin.Context) (claims *CustomClaims, err error) {
	if MyClaims, exist := c.Get("claims"); !exist {
		return MyClaims.(*CustomClaims), errors.New("jwt解析信息失败, 请检查请求头是否存在x-token且claims是否为规定结构")
	} else {
		return MyClaims.(*CustomClaims), nil
	}

}
